n,m = map(int,input())
a = list(map(int,input()))  # 点权
for _ in range(n-1):
    